<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:include href="../manager/menu.xsl" />
	<xsl:include href="../manager/footer.xsl" />
	<xsl:include href="../jquery/jquery.xsl" />
	<xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
		doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
		method="xml" encoding="UTF-8" />
	<xsl:template match="/">
		<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
			<head>
				<title>Manager Framework maps</title>
				<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

				<link rel="stylesheet" href="public/manager/css/manager.css"
					type="text/css" media="screen" />
				<link rel="stylesheet" href="public/manager/css/maps.css" type="text/css"
					media="screen" />
				<xsl:call-template name="jqueryInclude" />
				<script type="text/javascript" src="public/maps/js/maps.js"></script>
				<script type="text/javascript" src="public/manager/js/menu.js"></script>

			</head>
			<body>

				<div id="dialogDel" title="Del a map">
					<form>
						<fieldset>
							<p id="delMapInfo"></p>
						</fieldset>
					</form>
				</div>
				

				<div id="dialog" title="Create new map">
					<p id="validateTips"></p>
					<form>
						<fieldset>
							<label for="mapName">Name</label>
							<input type="text" name="mapName" id="mapName"
								class="text ui-widget-content ui-corner-all" />
							<p id="addMapResult"></p>
						</fieldset>
					</form>
				</div>


				<div id="header">
					<img id="logo" src="public/manager/images/bando.png" alt="inovia" />
				</div>
				<div id="date">
					<xsl:value-of select=".//site/date" />
				</div>


				<xsl:call-template name="displayMenu">
					<xsl:with-param name="selectedMenu" select="string('maps')" />
				</xsl:call-template>


				<div id="PageLeft">

					<div id="menutaches">
						<h2>Actions</h2>
						<ul style="margin-left:-15px">
							<li>
								<a href="#" id="addMap">
									<img src="public/manager/images/stock_new.png" alt="new map"
										title="new map" />
								</a>
								Add an map
							</li>
						</ul>
						<hr />
					</div>


					<div id="content">
						<h1 id="pageName" style="width:500px;"> Maps   </h1>
						<xsl:variable name="nbMaps" select="count(//site/maps/map)" />
						<xsl:variable name="page" select="//site/navigation/page" />
						<xsl:variable name="numpage" select="//site/navigation/numpage" />
						<xsl:variable name="order" select="//site/navigation/order" />
						<xsl:variable name="orderkind" select="//site/navigation/orderkind" />
						<xsl:variable name="parameter"
							select="//site/navigation/parameter/@param" />
						<xsl:variable name="value" select="//site/navigation/parameter" />
						<xsl:if test="$nbMaps=0">
							No map
						</xsl:if>
						<xsl:variable name="nbError" select="count(//error)" />
						<xsl:if test="$nbError!=0">
							<p>
								<xsl:for-each select=".//error">
									<xsl:value-of select="text" />
									<br />
								</xsl:for-each>
							</p>
						</xsl:if>

						<xsl:variable name="deleted" select="count(//deleted)" />
						<xsl:if test="$deleted!=0">
							<p>The map has been deleted</p>
						</xsl:if>

						<xsl:variable name="inserted" select="count(//inserted)" />
						<xsl:if test="$inserted!=0">
							<p class="important">The map has been added</p>
						</xsl:if>

						<xsl:variable name="umodified" select="count(//mapmodified)" />
						<xsl:if test="$umodified!=0">
							<p class="important">The map has been edited</p>
						</xsl:if>


						<div
							style="margin:10px 0 0 20px;width:770px;padding:0px;border:1px dotted #AAAAAA;background-color:#ECF3E1;">
							<div id="Pages">
								<div class="Paginator">

									<xsl:variable name="prev"
										select="//site/navigation/previous/text()" />
									<xsl:variable name="prevl" select="$page - 1" />
									<xsl:choose>
										<xsl:when test="$prev = 'disabled'">
											<span class="AtStart">&lt; Prev</span>
										</xsl:when>
										<xsl:otherwise>
											<a
												href="index.php?action=mapList&amp;order={$order}&amp;orderkind={$orderkind}&amp;page={$prevl}&amp;numpage={$numpage}&amp;parameter={$parameter}&amp;value={$value}"
												class="Prev">&lt; Prev</a>
										</xsl:otherwise>
									</xsl:choose>


									<xsl:for-each select="//site/navigation/pageslinks/pagelink">
										<xsl:variable name="mystate" select="./@state" />
										<xsl:variable name="mypage" select="./pagelink/text()" />
										<xsl:choose>
											<xsl:when test="$mystate = 'active'">
												<span class="break">
													<xsl:value-of select="text()" />
												</span>
											</xsl:when>
											<xsl:otherwise>
												<a class="pageList"
													href="index.php?action=mapList&amp;order={$order}&amp;orderkind={$orderkind}&amp;page={text()}&amp;numpage={$numpage}&amp;parameter={$parameter}&amp;value={$value}">
													<xsl:value-of select="text()" />
												</a>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:for-each>


									<xsl:variable name="next" select="//site/navigation/next/text()" />
									<xsl:choose>
										<xsl:when test="$next = 'disabled'">
											<span class="AtEnd">Next &gt;</span>
										</xsl:when>
										<xsl:otherwise>
											<a
												href="index.php?action=mapList&amp;order={$order}&amp;orderkind={$orderkind}&amp;page={$page+1}&amp;numpage={$numpage}&amp;parameter={$parameter}&amp;value={$value}"
												class="Next">Next &gt;</a>
										</xsl:otherwise>
									</xsl:choose>

								</div>
								<div class="Results">
									<font color="#ff9900">
										<xsl:value-of select="//site/navigation/numresults/text()" />
									</font>
									results
									displayed per :
									<a class="perpage"
										href="index.php?action=mapList&amp;order={$order}&amp;orderkind={$orderkind}&amp;page={$page}&amp;numpage=25&amp;parameter={$parameter}&amp;value={$value}">25</a>
									-
									<a class="perpage"
										href="index.php?action=mapList&amp;order={$order}&amp;orderkind={$orderkind}&amp;page={$page}&amp;numpage=50&amp;parameter={$parameter}&amp;value={$value}">50</a>
									-
									<a class="perpage"
										href="index.php?action=mapList&amp;order={$order}&amp;orderkind={$orderkind}&amp;page={$page}&amp;numpage=100&amp;parameter={$parameter}&amp;value={$value}">100</a>
									-
									<a class="perpage"
										href="index.php?action=mapList&amp;order={$order}&amp;orderkind={$orderkind}&amp;page={$page}&amp;numpage=200&amp;parameter={$parameter}&amp;value={$value}">200</a>
									<xsl:if test="$parameter != ''">
										filtered by :
										<font color="#ff9900">
											<xsl:value-of select="//site/navigation/parameter/@param" />
										</font>
										LIKE
										<font color="#ff9900">
											<xsl:value-of select="//site/navigation/parameter/text()" />
										</font>
										<a
											href="index.php?action=mapList&amp;order={$order}&amp;orderkind={$orderkind}&amp;page={$page}&amp;numpage={$numpage}"
											title="disable">X</a>

									</xsl:if>
								</div>
							</div>

							<div style="text-align:right;margin-bottom:5px;">
							</div>
							<table style="width:755px;padding:0px;spacing:0px;border:0px;">
								<tr id="trnav" style="background-color:#C2C9C9;font-weight:bold;">
									<td>
										<span class="maps_column"
											onclick="makeFormRequest(this,'{$order}','{$orderkind}','{$page}','{$numpage}')">Id</span>
										<a class="arrowdesc"
											href="index.php?action=mapList&amp;order=id&amp;orderkind=asc&amp;page={$page}&amp;numpage={$numpage}&amp;parameter={$parameter}&amp;value={$value}"
											alt="desc"></a>
										<a class="arrowasc"
											href="index.php?action=mapList&amp;order=id&amp;orderkind=desc&amp;page={$page}&amp;numpage={$numpage}&amp;parameter={$parameter}&amp;value={$value}"
											alt="asc"></a>
									</td>
									<td>
										<span class="maps_column"
											onclick="makeFormRequest(this,'{$order}','{$orderkind}','{$page}','{$numpage}')">Name</span>
										<a class="arrowdesc"
											href="index.php?action=mapList&amp;order=name&amp;orderkind=asc&amp;page={$page}&amp;numpage={$numpage}&amp;parameter={$parameter}&amp;value={$value}"></a>
										<a class="arrowasc"
											href="index.php?action=mapList&amp;order=name&amp;orderkind=desc&amp;page={$page}&amp;numpage={$numpage}&amp;parameter={$parameter}&amp;value={$value}"></a>
									</td>
									<td style="text-align:center">Actions</td>
								</tr>
								<xsl:for-each select=".//site/maps/map">
									<tr>
										<td>
											<xsl:value-of select="id" />
										</td>
										<td>
											<xsl:value-of select="name" />
										</td>
										<td style="text-align:center">
											<xsl:variable name="mapname" select="map" />
											<a href="index.php?action=mapEditor&amp;id={id}">
												<img src="public/manager/images/stock_edit-16.png" alt="edit"
													title="edit" />
											</a>
											<a style="margin-left:10px;"
												href="#" onclick="return delMap({id}, 'Delete {name}')">
												<img src="public/manager/images/stock_delete-16.png"
													alt="delete" title="delete" />
											</a>

										</td>
									</tr>
								</xsl:for-each>
							</table>
						</div>
					</div>
				</div>
				<xsl:call-template name="displayFooter" />
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>

